package com.sec.android.app.myfiles.launch;

import android.app.Activity;
import android.content.Intent;

import com.sec.android.app.myfiles.info.AppConstants;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.navigation.NavigationInfo;
import com.sec.android.app.myfiles.navigation.NavigationManager;

/**
 * Created by daelight.kim on 2016-05-17.
 */
public class HandleExecutableRecentImp extends AbsHandleLaunchImp {
    @Override
    public boolean isMyJob(Intent intent) {
        boolean bRet = false;
        final String action = intent.getAction();
        if (AppConstants.Action.ACTION_EXECUTABLE_RECENT.equals(action)){
            bRet = true;
        }
        return bRet;
    }

    @Override
    public boolean _handleStart(int processId, Activity activity, Intent intent) {
        NavigationManager navigationMgr = NavigationManager.getInstance(processId);
        if (navigationMgr != null) {
            navigationMgr.clear();
            FileRecord record = FileRecord.createFileRecord(FileRecord.StorageType.Recent, AppConstants.StoragePath.RECENT_FILES);
            if (record != null) {
                NavigationInfo info = NavigationInfo.getInstance(NavigationInfo.NavigationMode.Normal, record);
                if (info != null) {
                    navigationMgr.enter(info);
                }
            }
        }
        return false;
    }
}
